package com.zhaoyue.study.groovy;

import com.google.common.collect.Maps;
import com.google.common.io.Files;

import java.io.File;
import java.nio.charset.Charset;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: Administrator
 * Date: 2017/2/6
 * Time: 11:42
 * To change this template use File | Settings | File Templates.
 */
public class FileDemo {



    public static void main(String[] args) throws Exception {

        List<String> str = Files.readLines(new File("c:guize.txt"), Charset.forName("utf-8"));
        System.out.println("size:" + str.size());

        Map<String,String> map = Maps.newHashMap();

        String sql = null;
        for(String s : str){
            if(map.containsKey(s)){
                //System.out.println("重复：" + s);
                continue;
            }
            map.put(s,s);
            String[] array = s.split(",");
            long amount = Long.valueOf(array[4]) * 100;
            sql = "INSERT INTO `carpool`.`car_fee` (`start_type`, `dest_type`, `car_min_seat`, `car_max_seat`, `car_fee`, `domain`, `status`, `company_id`, `gmt_modified`, `gmt_created`) \n" +
                    "VALUES ("+array[0]+", "+array[1]+", "+array[2]+", "+array[3]+", "+amount+", 1300, '1', '1', now(),now());";
            System.out.println(sql);
        }

    }
}
